package com.brp.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.brp.po.Cargo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author all
 * @since 2022-03-16
 */
public interface CargoMapper extends BaseMapper<Cargo> {
    @Update("update t_cargo set ${ew.customSqlSegment}")
    Integer updateCargo(@Param(Constants.WRAPPER) Wrapper<Cargo> wrapper);


    List<Cargo>getAllLike(String cargoVender);

    @Select("SELECT COUNT(0) FROM t_cargo INNER JOIN t_buyrecord\n" +
            "on t_buyrecord.fk_cargo_id=t_cargo.cargo_id WHERE cargo_vender LIKE '%${cargoVender}%' ")
    int getCount(String cargoVender);
}
